// 导入组件
import Home from '@/pages/Home'
import Login from '@/pages/Login'
import Register from '@/pages/Register'
import Search from '@/pages/Search'
import Detail from '@/pages/Detail'
import AddCartSuccess from '@/pages/AddCartSuccess'

// 路由规则
const routes = [
  // 路由重定向，刚打开页面时直接跳到home首页模块
  {
    path: '/',
    redirect: '/home'
  },
  // 首页模块
  {
    path:"/home",
    component: Home,
    meta:{
      // 这个show控制Footer组件是否显示
      show:true
    }
  },
  // 登录模块
  {
    path:"/login",
    component: Login,
    meta:{
      show:false
    }
  },
  // 注册模块
  {
    path:'/register',
    component: Register,
    meta:{
      show:false
    }
  },
  // 搜索模块
  {
    path: '/search/:keyword?',
    name:'search',
    component: Search,
    meta:{
      show:true
    }
  },
  // 商品详情模块
  {
    path: '/detail/:skuId',
    name: 'detail',
    component: Detail,
    meta:{
      show:true
    }
  },
  // 加入购物车成功
  {
    path:'/addCartSuccess',
    name:'addCartSuccess',
    component:AddCartSuccess,
    meta:{
      show:true
    }
  }

]
export default routes